package strs

import (
	"golang.org/x/text/encoding/simplifiedchinese"
	"golang.org/x/text/transform"
)

func BGBKToUTF8(s []byte) ([]byte, error) {
	res, _, err := transform.Bytes(simplifiedchinese.GBK.NewDecoder(), s)
	return res, err
}

func GBKToUTF8(s string) (string, error) {
	res, err := BGBKToUTF8([]byte(s))
	return string(res), err
}
